cmake_minimum_required(VERSION 3.5)

#project name
set(PROJECTNAME gate_server)

#output path
set(OUTPUT ./bin/)
project(${PROJECTNAME})

set(CMAKE_C_COMPILER gcc)
set(CMAKE_CXX_COMPILER g++)
set(CMAKE_BUILD_TYPE Release)

#include directories
include_directories(
	./
	../anet
	../anet/asio
	../anet/msgpack-c
	../anet/log
	../anet/util
	../anet/timer
	../anet/shm
	../pipe_module/include
	../pipe_module
	../redis_lib/
	../redis_lib/hiredis
	)

#library.
SET(LIBRARIES
    -lpthread
	-lpipe_module
    )

#link directories
link_directories(
	../../pipe_module/lib
)

#definition flag
add_definitions(
	-std=c++17 
	-g 
	-O3 
	#-Wno-unused-variable 
	-Wall 
	#-Wno-deprecated
)

#output path
set(EXECUTABLE_OUTPUT_PATH ${OUTPUT})

#project src files
file(GLOB SRC_FILES "*.cpp" "*.hpp" "*.h" "*.c" "*.cc")
aux_source_directory(../anet ANET_FILES)
aux_source_directory(../anet/log LOG_SRC)
aux_source_directory(../anet/util util_src)
aux_source_directory(../anet/timer timer_src)
aux_source_directory(../anet/shm shm_src)
aux_source_directory(./net net_src)
aux_source_directory(./config config_src)
aux_source_directory(../redis_lib redis_src)
aux_source_directory(../redis_lib/hiredis redis_lib_hiredis_SRC)

# all c,cpp sources.
set(SRC
    ${SRC_FILES}
    ${LOG_SRC}
	${ANET_FILES}
	${util_src}
	${timer_src}
	${net_src}
	${shm_src}
	${config_src}
	${redis_src}
	${redis_lib_hiredis_SRC}
   )

#executable
add_executable(
	${PROJECTNAME}
	${SRC} 
	)

#link libraries
target_link_libraries(${PROJECTNAME} ${LIBRARIES})
